View Javadoc

1   /**
2    * Copyright 2008 WebPhotos
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  /*
17   * To change this template, choose Tools | Templates
18   * and open the template in the editor.
19   */
20  package net.sf.webphotos.netbeans;
21  
22  import java.awt.event.ActionEvent;
23  import javax.swing.AbstractAction;
24  import javax.swing.ImageIcon;
25  import org.openide.awt.ActionID;
26  import org.openide.awt.ActionReference;
27  import org.openide.awt.ActionRegistration;
28  import org.openide.util.ImageUtilities;
29  import org.openide.util.NbBundle;
30  import org.openide.util.NbBundle.Messages;
31  import org.openide.windows.TopComponent;
32  
33  /**
34   * Action which shows WebPhotosForm component.
35   */
36  @ActionID(id = "net.sf.webphotos.netbeans.WebPhotosFormAction", category = "Window")
37  @ActionRegistration(lazy = false, displayName = "#CTL_WebPhotosFormAction")
38  @ActionReference(path = "Menu/Window", name = "WebPhotosFormAction")
39  @Messages("CTL_WebPhotosFormAction=WebPhotosForm")
40  public class WebPhotosFormAction extends AbstractAction {
41  
42      public WebPhotosFormAction() {
43          super(NbBundle.getMessage(WebPhotosFormAction.class, "CTL_WebPhotosFormAction"));
44          putValue(SMALL_ICON, new ImageIcon(ImageUtilities.loadImage(WebPhotosFormTopComponent.ICON_PATH, true)));
45      }
46  
47      @Override
48      public void actionPerformed(ActionEvent evt) {
49          TopComponent win = WebPhotosFormTopComponent.findInstance();
50          win.open();
51          win.requestActive();
52      }
53  }